/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pe.edu.unmsm.cinfo.siga.datos;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author alumno
 */
@Entity
@Table(name = "PERSONAL")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Personal.findAll", query = "SELECT p FROM Personal p"),
    @NamedQuery(name = "Personal.findByPerCod", query = "SELECT p FROM Personal p WHERE p.perCod = :perCod"),
    @NamedQuery(name = "Personal.findByPerId", query = "SELECT p FROM Personal p WHERE p.perId = :perId"),
    @NamedQuery(name = "Personal.findByPerPw", query = "SELECT p FROM Personal p WHERE p.perPw = :perPw"),
    @NamedQuery(name = "Personal.findByPerNom", query = "SELECT p FROM Personal p WHERE p.perNom = :perNom"),
    @NamedQuery(name = "Personal.findByPerRuc", query = "SELECT p FROM Personal p WHERE p.perRuc = :perRuc"),
    @NamedQuery(name = "Personal.findByPerDir", query = "SELECT p FROM Personal p WHERE p.perDir = :perDir"),
    @NamedQuery(name = "Personal.findByPerTel1", query = "SELECT p FROM Personal p WHERE p.perTel1 = :perTel1"),
    @NamedQuery(name = "Personal.findByPerTel2", query = "SELECT p FROM Personal p WHERE p.perTel2 = :perTel2"),
    @NamedQuery(name = "Personal.findByPerMail", query = "SELECT p FROM Personal p WHERE p.perMail = :perMail"),
    @NamedQuery(name = "Personal.findByPerDni", query = "SELECT p FROM Personal p WHERE p.perDni = :perDni"),
    @NamedQuery(name = "Personal.findByPerEstado", query = "SELECT p FROM Personal p WHERE p.perEstado = :perEstado"),
    @NamedQuery(name = "Personal.findByPerDocente", query = "SELECT p FROM Personal p WHERE p.perDocente = :perDocente"),
    @NamedQuery(name = "Personal.findByPerCodAlu", query = "SELECT p FROM Personal p WHERE p.perCodAlu = :perCodAlu"),
    @NamedQuery(name = "Personal.findByPerDependencia", query = "SELECT p FROM Personal p WHERE p.perDependencia = :perDependencia"),
    @NamedQuery(name = "Personal.findByPerFechNac", query = "SELECT p FROM Personal p WHERE p.perFechNac = :perFechNac"),
    @NamedQuery(name = "Personal.findByPerImpRent", query = "SELECT p FROM Personal p WHERE p.perImpRent = :perImpRent")})
public class Personal implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "PER_COD")
    private Integer perCod;
    @Column(name = "PER_ID")
    private String perId;
    @Column(name = "PER_PW")
    private String perPw;
    @Basic(optional = false)
    @Column(name = "PER_NOM")
    private String perNom;
    @Column(name = "PER_RUC")
    private String perRuc;
    @Column(name = "PER_DIR")
    private String perDir;
    @Column(name = "PER_TEL1")
    private String perTel1;
    @Column(name = "PER_TEL2")
    private String perTel2;
    @Column(name = "PER_MAIL")
    private String perMail;
    @Column(name = "PER_DNI")
    private String perDni;
    @Basic(optional = false)
    @Column(name = "PER_ESTADO")
    private short perEstado;
    @Column(name = "PER_DOCENTE")
    private Integer perDocente;
    @Column(name = "PER_COD_ALU")
    private String perCodAlu;
    @Column(name = "PER_DEPENDENCIA")
    private String perDependencia;
    @Column(name = "PER_FECH_NAC")
    @Temporal(TemporalType.DATE)
    private Date perFechNac;
    @Column(name = "PER_IMP_RENT")
    private Short perImpRent;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "personal", fetch = FetchType.LAZY)
    private List<PersonalUnidad> personalUnidadList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "personal", fetch = FetchType.LAZY)
    private List<HistTipPers> histTipPersList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "personal", fetch = FetchType.LAZY)
    private List<HorarioPersonal> horarioPersonalList;

    public Personal() {
    }

    public Personal(Integer perCod) {
        this.perCod = perCod;
    }

    public Personal(Integer perCod, String perNom, short perEstado) {
        this.perCod = perCod;
        this.perNom = perNom;
        this.perEstado = perEstado;
    }

    public Integer getPerCod() {
        return perCod;
    }

    public void setPerCod(Integer perCod) {
        this.perCod = perCod;
    }

    public String getPerId() {
        return perId;
    }

    public void setPerId(String perId) {
        this.perId = perId;
    }

    public String getPerPw() {
        return perPw;
    }

    public void setPerPw(String perPw) {
        this.perPw = perPw;
    }

    public String getPerNom() {
        return perNom;
    }

    public void setPerNom(String perNom) {
        this.perNom = perNom;
    }

    public String getPerRuc() {
        return perRuc;
    }

    public void setPerRuc(String perRuc) {
        this.perRuc = perRuc;
    }

    public String getPerDir() {
        return perDir;
    }

    public void setPerDir(String perDir) {
        this.perDir = perDir;
    }

    public String getPerTel1() {
        return perTel1;
    }

    public void setPerTel1(String perTel1) {
        this.perTel1 = perTel1;
    }

    public String getPerTel2() {
        return perTel2;
    }

    public void setPerTel2(String perTel2) {
        this.perTel2 = perTel2;
    }

    public String getPerMail() {
        return perMail;
    }

    public void setPerMail(String perMail) {
        this.perMail = perMail;
    }

    public String getPerDni() {
        return perDni;
    }

    public void setPerDni(String perDni) {
        this.perDni = perDni;
    }

    public short getPerEstado() {
        return perEstado;
    }

    public void setPerEstado(short perEstado) {
        this.perEstado = perEstado;
    }

    public Integer getPerDocente() {
        return perDocente;
    }

    public void setPerDocente(Integer perDocente) {
        this.perDocente = perDocente;
    }

    public String getPerCodAlu() {
        return perCodAlu;
    }

    public void setPerCodAlu(String perCodAlu) {
        this.perCodAlu = perCodAlu;
    }

    public String getPerDependencia() {
        return perDependencia;
    }

    public void setPerDependencia(String perDependencia) {
        this.perDependencia = perDependencia;
    }

    public Date getPerFechNac() {
        return perFechNac;
    }

    public void setPerFechNac(Date perFechNac) {
        this.perFechNac = perFechNac;
    }

    public Short getPerImpRent() {
        return perImpRent;
    }

    public void setPerImpRent(Short perImpRent) {
        this.perImpRent = perImpRent;
    }

    @XmlTransient
    public List<PersonalUnidad> getPersonalUnidadList() {
        return personalUnidadList;
    }

    public void setPersonalUnidadList(List<PersonalUnidad> personalUnidadList) {
        this.personalUnidadList = personalUnidadList;
    }

    @XmlTransient
    public List<HistTipPers> getHistTipPersList() {
        return histTipPersList;
    }

    public void setHistTipPersList(List<HistTipPers> histTipPersList) {
        this.histTipPersList = histTipPersList;
    }

    @XmlTransient
    public List<HorarioPersonal> getHorarioPersonalList() {
        return horarioPersonalList;
    }

    public void setHorarioPersonalList(List<HorarioPersonal> horarioPersonalList) {
        this.horarioPersonalList = horarioPersonalList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (perCod != null ? perCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Personal)) {
            return false;
        }
        Personal other = (Personal) object;
        if ((this.perCod == null && other.perCod != null) || (this.perCod != null && !this.perCod.equals(other.perCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "pe.edu.unmsm.cinfo.siga.datos.Personal[ perCod=" + perCod + " ]";
    }
    
}
